/**   
 * @Title: BaseService.java
 * @Package com.cityoneyes.service.impl
 * @Description: TODO
 * @author Rick
 * @date 2011-8-2 上午12:45:54
 * @version V1.0   
 */
package com.momeating.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.cityoneyes.dao.BaseDAO;
import com.cityoneyes.service.IBaseService;

/**
 * @ClassName: BaseService
 * @Description: BaseService实现类
 * @author Rick
 * @date 2011-8-2 上午12:45:54
 */
@Service("baseService")
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class })
public class BaseServiceImpl implements IBaseService {

	@Autowired
	@Qualifier("baseDao")
	private BaseDAO baseDao;

	public boolean add(Object obj) {
		baseDao.save(obj);
		return true;
	}

	public boolean delete(Object obj) {
		baseDao.delete(obj);
		return true;
	}

	public boolean deleteById(Class objClass, int id) {
		baseDao.delete(objClass, id);
		return true;
	}

	public Object getById(Class objClass, int id) {
		return baseDao.get(objClass, id);
	}

	public boolean update(Object obj) {
		baseDao.update(obj);
		return true;
	}

	public List getAll(Class objClass) {
		return baseDao.findAll(objClass);
	}

	public int getCount(Class objClass) {
		return baseDao.count(objClass);
	}
	
}
